feat(nav-tab): require aria-label(ledby) or label#748
Open
nataliadelmar wants to merge 2 commits intomomentum-design:masterfrom
Open
feat(nav-tab): require aria-label(ledby) or label#748nataliadelmar wants to merge 2 commits intomomentum-design:masterfrom
nataliadelmar wants to merge 2 commits intomomentum-design:masterfrom
Conversation
lismith2-cisco
requested changes
Jan 8, 2025
| const NavigationTab: FC<Props> = (props: Props) => { | ||
| const { icon, label, count = 0, className, id, size, style, active, ...otherProps } = props; | ||
|
|
||
| const isExpanded = size == 200; |
Collaborator
There was a problem hiding this comment.
I know this is a copy-paste, but I think our convention is always to use triple equals
| data-size={size || DEFAULTS.SIZE} | ||
| id={id} | ||
| style={style} | ||
| aria-label={isExpanded && label ? props['aria-label'] : props['aria-label'] || label} // if expanded with label, the accessible name will default to the visible label inside. |
Collaborator
There was a problem hiding this comment.
I don't get what you're doing here
| data-size={size || DEFAULTS.SIZE} | ||
| id={id} | ||
| style={style} | ||
| aria-label={isExpanded && label ? props['aria-label'] : props['aria-label'] || label} // if expanded with label, the accessible name will default to the visible label inside. |
Collaborator
There was a problem hiding this comment.
And you've not added any unit tests for it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is important that, when the NavTab is not expanded, the circular button remains with an aria-label.
To prevent that, we are making aria-label(ledby) or label required and using it to label the nav tab in case it is not expanded.
Non-breaking change in Cantina as all instances of NavigationTab have aria-labels 🎉